package com.example.goodsmanagementcabinet.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.example.goodsmanagementcabinet.R;
import com.example.goodsmanagementcabinet.bean.RecordBean;

import java.util.ArrayList;
import java.util.List;


public class RecordAdapter extends BaseAdapter {
    private Context mContext;
    private List<RecordBean> listViewData = new ArrayList<>();

    public RecordAdapter(Context context) {
        this.mContext = context;
    }


    public void notifyRefresh(List list) {
        listViewData.clear();
        listViewData.addAll(list);
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return listViewData.size();
    }

    @Override
    public Object getItem(int position) {
        return listViewData.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }


    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holderView;
        View view;
        if (convertView == null) {
            holderView = new ViewHolder();
            view = LayoutInflater.from(mContext).inflate(R.layout.item_takeover_userlist, parent, false);
            view.setTag(holderView);
        } else {
            view = convertView;
            holderView = (ViewHolder) view.getTag();
        }
        return view;
    }

    public class ViewHolder {
        private EditText mKeyCode;
        private TextView mlockIdT;
        private Button mAdd;
    }
}
